﻿using PBO.Network;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace PBO.Forms.NetworkForm.BattleForm
{
    public class AgentObserverForm : BattleObserverForm
    {
        private int _identity;
        public AgentObserverForm(int identity, string address, byte position)
            : base(address, position)
        {
            //InitializeComponent();
            _identity = identity;
        }
        protected override void ConnectServer()
        {
            _client.OnPlayerExit += PlayerExit;
            _client.SetPort((int)ServerPort.BattleAgentServerPort);
            base.ConnectServer();
        }
        protected override void ConnectedServer()
        {
            _client.RegistObserver(_identity);
        }
        private void PlayerExit(string name)
        {
            Logger.AppendText(string.Format("{0}离开了游戏.", name));
        }
    }
}
